package com.example.finance_manager.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class SQLiteHelper extends SQLiteOpenHelper {
    public SQLiteHelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    public SQLiteHelper(@Nullable Context context) {
        super(context, "test", null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        sqLiteDatabase.execSQL("create table payout(id INTEGER  primary key autoincrement," + " time varchar2(20), address varchar2(20)," +
                "type varchar2(20), other varchar2(20), money double(20))");
        sqLiteDatabase.execSQL("create table salary(id INTEGER  primary key autoincrement,time varchar2(20),pay varchar2(20),type varchar2(20)," + "other varchar2(20),money double(20))");
        sqLiteDatabase.execSQL("create table flag(id INTEGER primary key autoincrement, contain varchar2(50))");
        sqLiteDatabase.execSQL("create table user(id INTEGER primary key autoincrement, username varchar2(20), password varchar2(20))");

        sqLiteDatabase.execSQL("create table room(id INTEGER primary key autoincrement, type varchar2(20), size varchar2(20), window INTEGER, bed varchar2(20), capacity INTEGER, used INTEGER)");
        sqLiteDatabase.execSQL("create table record(id INTEGER primary key autoincrement, roomId INTEGER, client varchar2(20), phone varchar2(20))");
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
